import api from './api';

// 监控相关API
export const monitorApi = {
  // 基础监控API
  getPerformanceMetrics: () => api.get('/monitor/performance'),
  getPerformanceHistory: (timeRange: string = '1h') => 
    api.get('/monitor/performance/history', { params: { time_range: timeRange } }),
  getSystemMetrics: () => api.get('/monitor/system'),
  clearMonitoringData: () => api.delete('/monitor/clear'),

  // 增强监控API
  getConsumerGroupsMetrics: () => api.get('/monitor/consumer-groups/metrics'),
  getConsumerGroupLagHistory: (groupId: string, topicName?: string, hours: number = 24) => 
    api.get(`/monitor/consumer-groups/${groupId}/lag-history`, {
      params: { topic_name: topicName, hours }
    }),
  getThroughputMetrics: () => api.get('/monitor/throughput'),
  getTopicThroughputHistory: (topicName: string, hours: number = 24) =>
    api.get(`/monitor/topics/${topicName}/throughput-history`, {
      params: { hours }
    }),
  getClusterHealth: () => api.get('/monitor/cluster/health'),
  getClusterHealthHistory: (hours: number = 24) =>
    api.get('/monitor/cluster/health-history', {
      params: { hours }
    }),
  getMonitoringSummaryReport: () => api.get('/monitor/reports/summary'),
};

export default monitorApi;
